package com.design.pattern.prototype;

/**
 * 浅copy,java实现原型模式很简单,只需要实现clone接口即可
 */
public class ShallowCopy  implements Cloneable {
    /**
     * 浅copy
     * @return
     */
    @Override
    public ShallowCopy clone(){
        ShallowCopy shallowCopy=null;
        try {
            shallowCopy= (ShallowCopy)super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return shallowCopy;
    }
}
